<form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
    <div class="layui-card-body" style="padding-top: 20px;height: 100%" id="media">
        <div class="layui-form-item">
            <label class="layui-form-label">课程分类</label>
            <div class="layui-input-block">
                <input name="cate_id" required value="{$vo.cate_id|default=''}" placeholder="请选择分类"  class="layui-input selectpage" data-source="/admin/course_cate/selectpage" data-field="name">
            </div>
        </div>

        <!--学校-->
        <input type='hidden' value='{:session("school_user.school_id")}' name='school_id'>

        <div class="layui-form-item">
            <label class="layui-form-label">年级</label>
            <div class="layui-input-inline">
                <input name="grade_id" value="{$vo.grade_id|default=''}" placeholder="请选择年级，非必填"  class="layui-input selectpage" data-source="/admin/school_grade/selectpage" data-field="name">
            </div>
            <label class="layui-form-label">班级</label>
            <div class="layui-input-inline">
                <input name="class_id" value="{$vo.class_id|default=''}" placeholder="请选择班级，非必填"  class="layui-input selectpage" data-source="/admin/school_class/selectpage" data-field="name">

            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">授课教师</label>
            <div class="layui-input-block">
                <input name="teacher_id" value="{$vo.teacher_id|default=''}" placeholder="请选择授课教师，非必填"  class="layui-input selectpage" data-source="/admin/user/selectpage" data-where="role=2" data-field="realname">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">课程名称</label>
            <div class="layui-input-block">
                <input name="name" required class="layui-input" placeholder="请输入课程名称" value="{$vo.name|default=''}">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">课程标题</label>
            <div class="layui-input-block">
                <input name="title" required class="layui-input" placeholder="请输入课程标题" value="{$vo.title|default=''}">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">上课时间</label>
            <div class="layui-input-inline">
                <input name="time" required class="layui-input" placeholder="如周四 10:00-12:00" value="{$vo.time|default=''}">
            </div>
            <label class="layui-form-label">上课地点</label>
            <div class="layui-input-inline">
                <input name="address" required class="layui-input" placeholder="请填写上课地点" value="{$vo.address|default=''}">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">可报名总人数</label>
            <div class="layui-input-block">
                <input name="sign_total" required class="layui-input" placeholder="请输入总人数,无限制请填999"
                       value="{$vo.sign_total|default=''}">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">展示图(1张,<span style="color:red;">700px*700px</span>)</label>
            <div class="layui-input-block layui-form">
                <input name="logo" data-upload-image type="hidden" value="{$vo.logo|default=''}">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">详情图(多张,<span style="color:red;">750px*任意高度</span>)</label>
            <div class="layui-input-block layui-form">
                <input name="intro" data-upload-image="Multiple" type="hidden" value="{$vo.intro|default=''}">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">是否展示在首页</label>
            <div class="layui-input-block">
                {foreach ['1'=>'是','0'=>'否'] as $k=>$v}
                <input type="radio" data-is_hot="{$k}" name="is_hot" value="{$k}" title="{$v}" lay-filter="is_hot">
                {/foreach}
            </div>
        </div>

        <div class="hr-line-dashed"></div>
        <div class="layui-form-item text-center">
            <!--{notempty name='vo.id'}-->
            <input type='hidden' value='{$vo.id}' name='id'>
            <!--{/notempty}-->
            <button class="layui-btn" type='submit'>保存数据</button>
            <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗？" data-close>取消编辑</button>
        </div>
    </div>
</form>


{block name="script"}
<script>
    require(['layui'],function () {
        layui.use(['form','laydate','layer'],function() {
            window.form = layui.form;
            require(['form'], function () {
                apply('{$vo.is_hot|default="0"}');
                window.form.render();
                window.form.on('radio(is_hot)', function (data) {
                    apply(data.value);
                });
                function apply(value) {
                    $("[data-is_hot='" + value + "']").trigger('click');
                }
            })

        })
    });
</script>
{/block}